package cn.opopopo.design_pattern_learn.行为型.visitor;

// 文本元素
class TextElement implements DocumentElement {
    private String content;

    public TextElement(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    @Override
    public void accept(DocumentElementVisitor visitor) {
        visitor.visit(this); // 关键：把自己传给访问者
    }
}